package com.proxy;

/**
 * Created by CrazyShaQiuShi on 2017/1/24.
 * 对实现类HelloImpl的代理（即我们需要在这个实现类之前或者之后做的业务逻辑）
 */
public class HelloProxy implements Hello {
    private  HelloImpl helloImpl;
    public  HelloProxy(){
        helloImpl=new HelloImpl();
    }

    private  void  before(){
        System.out.println("ARE YOU OK?");
    }
    @Override
    public void say(String name) {
        before();
        helloImpl.say(name);
        after();
    }
    private void after(){
        System.out.println("NO!");
    }
}
